#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QSerialPort>      //串口必要头文件
#include <QtCharts/QChartView>
#include <QtCharts/QSplineSeries>
#include <QDateTimeAxis>
#include <QValueAxis>
#include <QTimer>
#include "QDateTime"

//  引入 “C”  库，为了实验fopen、fclose、fput函数
extern "C"{
    #include <stdio.h>
}

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    QSerialPort *serialport;
    //自定义的全局变量 串口打开状态标注位
    int openflag = 0;
    QTimer    timer; //声明QTimer对象
    QtCharts::QChart *chart;                           //画布
    QtCharts::QDateTimeAxis *axisX;                    //轴
    QtCharts::QValueAxis *axisY;
    QtCharts::QSplineSeries *series1;                     //线1
    QtCharts::QSplineSeries *series2;                     //线2
    QtCharts::QSplineSeries *series3;                     //线3
    void Chart_Init();

private slots:
    void on_pushButton_clicked();
    void serialReadData_slot();
    void on_pushButton_2_clicked();
//    void ReadFarme();

private:
    Ui::Widget *ui;
};
#endif // WIDGET_H
